package com.googlecode.mhtetris.tetris
{
	import away3d.containers.ObjectContainer3D;
	
	import flash.display.Sprite;

	public class NextBlock extends ObjectContainer3D
	{
		
		private var partie:Tetris3D;
		
		private var _gb:String;
		
		private var leBloc:GBlock;
		
		public function NextBlock(_partie:Tetris3D)
		{
			
			partie = _partie;
			
			/*graphics.lineStyle(1, 0x000000);
			graphics.drawRect(0,0,200,120);*/
			
			gb = partie.nextGBlock;
		}
		
		/**
		 * setter du bloc
		 */
		public function set gb(bloc:String):void {
			_gb = bloc;
			drawBloc();
		}
		
		private function drawBloc():void {
			if (leBloc && leBloc.parent) {
				leBloc.removeAllChildrenRecursivly(leBloc.parent);
				//removeChild(leBloc);
			}
			leBloc = null;
			leBloc = new GBlock(_gb, null);
			leBloc.x = (Tetris3D.LARGEUR_BLOCK_PX >> 1) - (Tetris3D.LARGEUR_BLOCK_PX / 4);
			leBloc.y = 50;//(this.height >> 1);
			addChild(leBloc);
		}
	}
}